function main_new()

% sets up grid to calculate surface
g1=[(0.399999:.0025:0.499999)'];
g2=[(0.4799999:.0025:0.5199999)'];

% allocates array to collect results
y_hat_keep=zeros(length(g1),length(g2),4);

% sets smoothing parameter
k=2;



%% diff results
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% gets RDD figure for avg_fare
by=importdata('D:\research\connan\compplan\data\matlab\dd_avg.txt');
bx=importdata('D:\research\connan\compplan\data\matlab\dd_fare_top2.txt');

[y1,x1,n1,y2,x2,n2,y3,x3,n3,y4,x4,n4] = gen_data(by,bx);
y_hat = local_linear_rdd(y1,x1,n1,y2,x2,n2,y3,x3,n3,y4,x4,n4,g1,g2,k);
clear y1 x1 n1 y2 x2 n2 y3 x3 n3 y4 x4;




ind=((0.399999<bx(:,1) & bx(:,1)<0.499999) & (0.4799999<bx(:,2) & bx(:,2)<0.5199999));
surf(g1,g2,y_hat')

%surf(g1(30:42),g2(16:27),y_hat(30:42,16:27)');


hold on
scatter3(bx(ind,1),bx(ind,2),by(ind))
xlim([.405 .505])
ylim([.475 .522])
zlim([-.1,.35])





end




